/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package bean;

import BO.SignLabBO;
import java.util.List;
import java.util.Map;
import javax.faces.context.FacesContext;
import pojo.SignLab;
import pojo.User;

/**
 *
 * @author phong
 */
public class SignListBean {

    /**
     * Creates a new instance of SignListBean
     */
    private String status = "All";
    private String useDate = "";
    private String timeTableId = "All";
    private List<SignLab> signLabs;

    public SignListBean() {
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getUseDate() {
        return useDate;
    }

    public void setUseDate(String useDate) {
        this.useDate = useDate;
    }

    public String getTimeTableId() {
        return timeTableId;
    }

    public void setTimeTableId(String timeTableId) {
        this.timeTableId = timeTableId;
    }

    public List<SignLab> getSignLabs() {
        return signLabs;
    }

    public void setSignLabs(List<SignLab> signLabs) {
        this.signLabs = signLabs;
    }

    //<editor-fold defaultstate="collapsed" desc="Lấy danh sach SignLab cho admin">
    public List<SignLab> getSignLabByAdmin() {
        this.signLabs = SignLabBO.getSignLabByAdmin(this.useDate, this.timeTableId, this.status);
        return this.signLabs;
    }
    //</editor-fold>

    //<editor-fold defaultstate="collapsed" desc="Lấy danh sach SignLab cua 1 user">
    public List<SignLab> getSignLabByUser() {
        FacesContext facesContext = FacesContext.getCurrentInstance();
        Map session = facesContext.getExternalContext().getSessionMap();
        User user = (User) session.get("User");
        this.signLabs = SignLabBO.getSignLabByUser(user.getId(), this.useDate, this.status);
        return this.signLabs;
    }
    //</editor-fold>
}
